Package edu.claflin.finder.algo
Class Algorithm
- java.lang.Object
-
- edu.claflin.finder.algo.Algorithm
-
- All Implemented Interfaces:
Processable<Graph,Graph>
- Direct Known Subclasses:
BreadthFirstTraversalSearch,BronKerbosch,Bundle,ClusteringAlgorithm,ConnectedComponentsDFS,DepthFirstTraversalSearch,DijkstraShortestPath,Kruskal,MatrixPatternAnalyzer,Prim,ShortestPath
public abstract class Algorithm extends java.lang.Object implements Processable<Graph,Graph>
Abstraction of the algorithm classes used for finding subgraphs.- Version:
- 3.4 February 2. 2015
- Author:
- Charles Allen Schultz II
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAlgorithm.GraphSortOrder
-
Field Summary
Fields Modifier and Type Field Description ArgumentsBundleargsThe ArgumentsBundle object holding arguments for the algorithm.(package private) intcounter(package private) CommunicationListenerlistenerprivate java.beans.PropertyChangeSupportmPCSAdds Property Change support to track the progress of algorithms.private intpartiteNumberNumber passed in using partite number.private doubleprogressThe current progress of the algorithm.static java.lang.StringPROP_PROGRESSConstant for indicating the progress property.private Algorithm.GraphSortOrdersortOrder
-
Constructor Summary
Constructors Constructor Description Algorithm(ArgumentsBundle args)Public Constructor for creating an Algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener pcl)Adds a PropertyChangeListener.private booleancompare(Graph base, Graph match)Compares the two graphs based on edges.protected java.util.ArrayList<Graph>cull(java.util.ArrayList<Graph> subGraphs)Removes duplicate subGraphs from the provided ArrayList.Algorithm.GraphSortOrdergetGraphSortOrder()intgetPartiteNumber()voidremovePropertyChangeListener(java.beans.PropertyChangeListener pcl)Removes a PropertyChangeListener.private booleanreorder(Graph base, Graph match)Deprecated.No replacement.voidsetGraphSortOrder(Algorithm.GraphSortOrder gso)voidsetPartiteNumber(int partiteNumber)protected voidsetProgress(double progress)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.claflin.finder.logic.processor.Processable
process
-
-
-
-
Field Detail
-
listener
CommunicationListener listener
-
counter
int counter
-
args
public final ArgumentsBundle args
The ArgumentsBundle object holding arguments for the algorithm.
-
mPCS
private java.beans.PropertyChangeSupport mPCS
Adds Property Change support to track the progress of algorithms.
-
progress
private double progress
The current progress of the algorithm.
-
partiteNumber
private int partiteNumber
Number passed in using partite number. Somewhat of a bandaid fix because haven't figured out the arguments bundle yet - kpuli
-
PROP_PROGRESS
public static final java.lang.String PROP_PROGRESS
Constant for indicating the progress property.- See Also:
- Constant Field Values
-
sortOrder
private Algorithm.GraphSortOrder sortOrder
-
-
Constructor Detail
-
Algorithm
public Algorithm(ArgumentsBundle args)
Public Constructor for creating an Algorithm.- Parameters:
args- the ArgumentsBundle containing the arguments for the Algorithm object.
-
-
Method Detail
-
setGraphSortOrder
public void setGraphSortOrder(Algorithm.GraphSortOrder gso)
-
getGraphSortOrder
public Algorithm.GraphSortOrder getGraphSortOrder()
-
setPartiteNumber
public void setPartiteNumber(int partiteNumber)
-
getPartiteNumber
public int getPartiteNumber()
-
cull
protected final java.util.ArrayList<Graph> cull(java.util.ArrayList<Graph> subGraphs)
Removes duplicate subGraphs from the provided ArrayList. This ensures that all found Graphs are unique.- Parameters:
subGraphs- the ArrayList containing the subGraphs to remove duplicates from.- Returns:
- the ArrayList of Graph objects containing only unique subgraphs.
-
reorder
private boolean reorder(Graph base, Graph match)
Deprecated.No replacement. There is no longer a need to reorder graphs to test equality.Reorders the supplied graphs so that the matrices match. The larger graph (in terms of node count) is reordered so that the order of its nodes mirrors that of the smaller. I.e. if the larger graph shares in common three nodes with the smaller, those three nodes are put into the same positions in the larger graph as they are in the smaller graph.- Parameters:
base- the Graph object (smaller) to base ordering on.match- the Graph object (larger) to reorder.- Returns:
- a boolean primitive indicating if the graphs are comparable.
-
compare
private boolean compare(Graph base, Graph match)
Compares the two graphs based on edges. Tests to see that the smaller graph is essentially a subGraph of the larger.- Parameters:
base- the Graph object (smaller) to match.match- the Graph object (larger) to test against.- Returns:
- a boolean primitive indicating if the smaller Graph is a subgraph of the larger.
-
setProgress
protected void setProgress(double progress)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds a PropertyChangeListener.- Parameters:
pcl- the PropertyChangeListener.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes a PropertyChangeListener.- Parameters:
pcl- the PropertyChangeListener.
-
-